package com.lz.spring.cloud.eureka.client.control;


import java.util.Random;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class CalcControl {

	protected static Logger LOGGER = LoggerFactory.getLogger(CalcControl.class);
	
	@GetMapping("/add/{a}/{b}")
	public String add(@PathVariable Integer a, @PathVariable Integer b){
		try {
			int sleepTime = new Random().nextInt(3);
			LOGGER.info("==into add==curretnTime=" + System.currentTimeMillis() + " sleepTime=" + sleepTime);
			//测试超时
			//Thread.sleep(sleepTime * 1000);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return a + " + " + b + " = " + (a + b);
	}
}
